package com.rdl.test;

import java.io.File;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.io.Writer;
import java.util.HashMap;
import java.util.Map;

import com.rdl.relation.FieldInfo;
import com.rdl.relation.FieldType;
import freemarker.template.Configuration;
import freemarker.template.DefaultObjectWrapper;
import freemarker.template.Template;
import freemarker.template.TemplateException;

public class LoadTemplate {
	public static void main(String argv[]){
		Configuration ftlConfig = new Configuration();
		try {
			ftlConfig.setDirectoryForTemplateLoading(new File("template"));
			ftlConfig.setObjectWrapper(new DefaultObjectWrapper());
			
			@SuppressWarnings("rawtypes")
			Map root = new HashMap();

			Template template = ftlConfig.getTemplate("study.ftl");
			Writer out = new OutputStreamWriter(System.out);
			
			try {
				template.process(root, out);
				out.flush();
			} catch (TemplateException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
			
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
}
